from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Optional, List
from module_admin.annotation.pydantic_annotation import as_query




class PlantServiceModel(BaseModel):
    """
    种植主体服务统计表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)

    id: Optional[int] = Field(default=None, description='记录id')
    year: Optional[int] = Field(default=None, description='数据统计年份')
    planter_id: Optional[int] = Field(default=None, description='种植主体id')
    planter_name: Optional[str] = Field(default=None, description='种植主体')
    service_month: Optional[str] = Field(default=None, description='服务月份')
    service_type: Optional[str] = Field(default=None, description='服务类型')
    service_count: Optional[int] = Field(default=None, description='服务次数')






class PlantServiceQueryModel(PlantServiceModel):
    """
    种植主体服务统计不分页查询模型
    """
    begin_year: Optional[str] = Field(default=None, description='开始数据统计年份')
    end_year: Optional[str] = Field(default=None, description='结束数据统计年份')
    begin_service_month: Optional[str] = Field(default=None, description='开始服务月份')
    end_service_month: Optional[str] = Field(default=None, description='结束服务月份')


@as_query
class PlantServicePageQueryModel(PlantServiceQueryModel):
    """
    种植主体服务统计分页查询模型
    """

    page_num: int = Field(default=1, description='当前页码')
    page_size: int = Field(default=10, description='每页记录数')


class DeletePlantServiceModel(BaseModel):
    """
    删除种植主体服务统计模型
    """

    model_config = ConfigDict(alias_generator=to_camel)

    ids: str = Field(description='需要删除的记录id')


class LineChartModel(BaseModel):
    name: str = Field(description='分类名称')
    type: str=Field(description='图形类型')
    stack: str=Field(description='堆叠分类')
    data: List[float]=Field(description='数值数组')

class PieChartModel(BaseModel):
    name: str = Field(description='分类名称')
    type: str=Field(description='图形类型')
    stack: str=Field(description='堆叠分类')
    data: List[float]=Field(description='数值数组')